function [Rf, error]=matchable(Rin)
R=[0.1,0.33,0.47,1000,1,1200,1.2,1500,1.5,1800,1.8,10000,10,100000,100,10000,12000,12,12400,120000,120,14000,15000,15,150000,150,18000,18,180000,180,2100,2200,2.2,2700,2.7,21000,22000,22,220000,220,27000,27,270000,270,3300,3.3,3650,3900,3.9,33000,33,330000,330,39000,39,390000,390,4220,4700,4.7,4990,47000,47,470,49900,5100,5.1,5600,5.6,56000,56,560,6190,6800,6.8,68000,68,680,7500,8200,8.2,82000,82,820,9100];

Rf=[0,0,0];

% Componente Solo
for x=1:length(Rin)
    error(x)=1;
    for t=1:length(R)
        if Rin(x)==R(t)
            Rf(x,1)=Rin(x);
            Rf(x,2)=0;
            Rf(x,3)=3;
            error(x)=0;
            break;
        end
    end
end


% Paralelo
for x=1:length(Rin)
    for t=1:length(R)
        for j=t:length(R)
            Rp=R(t)*R(j)/(R(t)+R(j));
            if Rp>=0.5*Rin(x) && Rp<=1.5*Rin(x)
                errorSample=abs(Rin(x)-Rp)/Rin(x);
                if errorSample<error(x)
                    Rf(x,1)=R(t);
                    Rf(x,2)=R(j);
                    Rf(x,3)=1; % 1 significa paralelo
                    error(x)=errorSample;
                end
            end
        end
    end
end

% Serie

for x=1:length(Rin)
    for t=1:length(R)
        for j=t:length(R)
              Rs=R(t)+R(j);
              if Rs>=0.5*Rin(x) && Rs<=1.5*Rin(x)
                errorSample=abs(Rin(x)-Rs)/Rin(x);
                if errorSample<error(x)
                    Rf(x,1)=R(t);
                    Rf(x,2)=R(j);
                    Rf(x,3)=0; % 0 significa serie
                    error(x)=errorSample;
                end
              end
        end
    end
end

error=100*error;
end